Skip to content

Conversation

songWukong
Copy link
Collaborator

No description provided.

@@ -1,8 +1,11 @@
from calc import *

class Interpreter:

__variables = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are using this for variable assignment why not store the corresponding values into the dictionary itself and then we can access each of values as keys.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do actually. And we can access values via keys like so:
variables = {'var1' : val1, 'var2' : val2}
print variables[var1]
output: val1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants